
#ifndef _ENGINE_H_
#define _ENGINE_H_	1


#include "httpcommon.h"
#include "ThreadPool.h"


class CProxyEngine
{
// External Interfaces
public:		
	~CProxyEngine();
	static CProxyEngine& GetInstance();

	bool InitProxyEngine(PROXY_INFO proxyInfo);
	bool DestroyProxyEngine();

	int proxyStart();
	int proxyStop();
	int proxySuspend();
	//option
	int proxySingleStep();
	int proxyDrop();

	// utilities
	const HANDLE *getEngineThread() { return &mEngineThread; } 

// Internal Functions
private:	
	CProxyEngine();

// Internal Data Members
private:	
	CThreadPool		*mPool;			// Thread Pool for Job
	MsgList			mReqResList;
	ENGINE_DATA		mEngineData;

	//control variables
	bool	mIsDestroy;
	bool	mIsStart;

	//for trap contrallable mode variable
//	unsigned int	mTrapMode;

	//synchronization objects for controllable proxy mode
//	HANDLE	mReqPassEvt;
//	HANDLE	mResPassEvt;
//	HANDLE	mDataStructMutex;
	HANDLE	mThreadMutex;

	HANDLE	mEngineThread;
	int		mEngineThreadId;
	static unsigned __stdcall EngineThreadFunc(void* pArg);
};















#endif
